package com.zhxi.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhxi.common.valid.AddGroup;
import com.zhxi.common.valid.OneZeroValue;
import com.zhxi.common.valid.UpdateGroup;
import com.zhxi.common.valid.UpdateStatusGroup;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @Author: zhxi
 * @Email: 664480310@qq.com
 * @Date: 2024-08-19 17:41:15
 * @Version: 1.0.0
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @NotNull(message = "修改必须传入id", groups = {UpdateGroup.class, UpdateStatusGroup.class})
    @Null(message = "新增不能指定id", groups = {AddGroup.class})
    private Long brandId;
    /**
     * 品牌名 至少一个非空字符
     */
    @NotBlank(message = "品牌名不能空", groups = {UpdateGroup.class, AddGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(message = "请上传logo！", groups = {AddGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(message = "必须选择显示状态！", groups = {UpdateGroup.class, AddGroup.class, UpdateStatusGroup.class})
    @OneZeroValue(vals = {0, 1}, groups = {UpdateGroup.class, AddGroup.class, UpdateStatusGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(message = "检索首字母不能为空！", groups = {UpdateGroup.class, AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母！")
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序字段不能为空！", groups = {UpdateGroup.class, AddGroup.class})
    @Min(value = 0, message = "排序字段必须大于等于0！", groups = {UpdateGroup.class, AddGroup.class})
    private Integer sort;

}
